<!DOCTYPE html>
<html>
<head>
    <script src="../resources/js-test.js"></script>
    <script>
        window.jsTestIsAsync = true;

        description("Detaching a frame should bypass it's cached permissionclient state in StorageAreaProxy.");

        if (window.testRunner && testRunner.setStorageAllowed)
            testRunner.setStorageAllowed(true);

        var frame, storage;
        window.onload = function () {
            frame = document.querySelector('iframe');
            storage = frame.contentWindow.localStorage;
            frame.parentElement.removeChild(frame);
            shouldThrow("storage.length");
            shouldThrow("storage.getItem('foo')");
            shouldThrow("storage.setItem('foo', 'bar')");
            shouldThrow("storage.key(0)");
            shouldThrow("storage.clear()");
            finishJSTest();
        };
    </script>
</head>
<body>
    <iframe srcdoc=""></iframe>
</body>
</html>
